﻿namespace IceCS.MovieRent
{
    public enum PriceCode
    {
        REGULAR = 0,
        NEW_RELEASE,
        CHILDRENS
    }

    public abstract class Price
    {
        public abstract PriceCode PriceCode { get; }

        public abstract double GetCharge(int daysRented);

        public virtual int GetFrequentRenterPoints(int daysRented)
        {
            return 1;
        }
    }

    public class RegularPrice : Price
    {
        public override PriceCode PriceCode { get => PriceCode.REGULAR; }
        public override double GetCharge(int daysRented)
        {
            double result = 2;
            if (daysRented > 2)
            {
                result += (daysRented - 2) * 1.5;
            }

            return result;
        }
    }
    public class NewReleasePrice : Price
    {
        public override PriceCode PriceCode { get => PriceCode.NEW_RELEASE; }
        public override double GetCharge(int daysRented)
        {
            return daysRented * 3;
        }

        public override int GetFrequentRenterPoints(int daysRented)
        {
            return (daysRented > 1) ? 2 : 1;
        }
    }
    public class ChildrenPrice : Price
    {
        public override PriceCode PriceCode { get => PriceCode.CHILDRENS; }
        public override double GetCharge(int daysRented)
        {
            double result = 1.5;
            if (daysRented > 3)
            {
                result += (daysRented - 3) * 1.5;
            }
            return result;
        }
    }
}
